<?php
//get the id of the shopping cart
$shoppingcart_id = $_COOKIE["shoppingcart_id"];

//interrogate the database to see how many items are contained
$items = mysql_query("SELECT COUNT(*) AS NR FROM rel WHERE ID_CART = '$shoppingcart_id'");

//extract the array from the sql resulting table
$item_nr = mysql_fetch_array($items);

//display information
echo("Your cart contains ".$item_nr["NR"]." items");
?>